<template>
  <div id="chartPie" :style="{ width: '100%', height: '100%' }"></div>
</template>

<script>
export default {
  data() {
    return {
      chartOption: {
        title: {
          text: '2019年度账号权限管理审计专题每月占比',
          left: 'center'
        },
        tooltip: {
          trigger: 'item',
          formatter: '{a} <br/>{b} : {c} ({d}%)'
        },
        series: [
          {
            name: '2019年度账号权限管理审计专题每月占比',
            type: 'pie',
            radius: '55%',
            center: ['50%', '60%'],
            roseType: 'radius',
            data: [
              { name: '2019/2/1', value: 8765 },
              { name: '2019/3/1', value: 3678 },
              { name: '2019/4/1', value: 6543 },
              { name: '2019/5/1', value: 3245 },
              { name: '2019/6/1', value: 8789 },
              { name: '2019/7/1', value: 5869 },
              { name: '2019/8/1', value: 8997 },
              { name: '2019/9/1', value: 7658 },
              { name: '2019/10/1', value: 8756 },
              { name: '2019/11/1', value: 2345 },
              { name: '2019/12/1', value: 4743 }
            ],
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
            }
          }
        ]
      }
    }
  },

  mounted() {
    this.drawLine()
  },

  methods: {
    drawLine() {
      // 基于准备好的dom，初始化echarts实例
      let myChart = this.$echarts.init(document.getElementById('chartPie'))
      // 绘制图表
      myChart.setOption(this.chartOption)
    }
  }
}
</script>

<style lang="scss" scoped></style>
